<?php
namespace app\admin\validate;

use think\Validate;

class Coupon extends Validate
{
    protected $rule = [
        'name'         => 'require|unique:user|max:100',
        'payMoney'    => 'require|number|max:10',
        'offsetMoney'    => 'require|number|max:10',
        'period'    => 'require|number|max:5'
    ];

    protected $message = [
        'name.require'         => '请输入优惠券名称',
        'name.unique'          => '优惠券名称已存在',
        'name.max'          => '优惠券名称过长',
        'payMoney.require'            => '请输入支付金额',
        'payMoney.number'            => '支付金额格式错误',
        'payMoney.max'            => '支付金额最多10位数',
        'offsetMoney.require'            => '请输入抵消金额',
        'offsetMoneyMoney.number'    => '抵消金额格式错误',
        'offsetMoneyMoney.max'            => '抵消金额最多10位数',
        'period.require'            => '请输入有效期(天)',
        'period.number'    => '有效期格式错误',
        'period.max'  => '有效期最多5位数'
    ];
}